extends Control

const RUN_SCENE = preload("uid://cril8uc68dodn")

const ASSASSIN = preload("uid://dn1d0fc5nm5j3")
const WARRIOR = preload("uid://brmniwqf000j1")
const WIZARD = preload("uid://0sb7et4xq4gl")

@export var run_startup: RunStartup

@onready var title: Label = %Title
@onready var description: Label = %Description

@onready var character_portrait: TextureRect = %CharacterPortrait

var current_character: CharacterStats: set = _set_character_stats

func _ready() -> void:
	current_character = WARRIOR

func _set_character_stats(value: CharacterStats) -> void:
	current_character = value
	character_portrait.texture = current_character.portrait
	title.text = current_character.character_name
	description.text = current_character.description
	
func _on_start_button_pressed() -> void:
	run_startup.type = RunStartup.Type.NEW_RUN
	run_startup.character = current_character
	get_tree().change_scene_to_packed(RUN_SCENE)

func _on_warrior_button_pressed() -> void:
	current_character = WARRIOR


func _on_wizard_button_pressed() -> void:
	current_character = WIZARD


func _on_assassin_button_pressed() -> void:
	current_character = ASSASSIN
